package com.gxust.conf.swagger;

import com.gxust.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestSwaggerController {
    @Api(tags = "测试")
    @RestController
    @RequestMapping("/user")
    public class UserController {
        @ApiOperation("测试接口1")
        @PostMapping("/show1")
        public String show1(@ApiParam(value = "姓名", required = true, example = "liwei") @RequestBody String name) {
            return "hello," + name + ",welcome to springboot swagger2！";
        }
        @ApiOperation("测试接口2")
        @PostMapping("/show2")
        public String show2(@ApiParam(value = "用户对象", required = true) @RequestBody User user) {
            return "hello," + user.getUsername() + ",welcome to springboot swagger2！";
        }
    }
}
